<!doctype html>



  


<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>






<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Linux,常用操作命令," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.1" />






<meta name="description" content="LINUX中常用操作命令 Linux简介及Ubuntu安装Linux，免费开源，多用户多任务系统。基于Linux有多个版本的衍生。RedHat、Ubuntu、Debian安装VMware或VirtualBox虚拟机。具体安装步骤，找百度。再安装Ubuntu。具体安装步骤，找百度。安装完后，可以看到Linux系统的目录结构，见链接http://www.cnblogs.com/laov/p/3409">
<meta name="keywords" content="Linux,常用操作命令">
<meta property="og:type" content="article">
<meta property="og:title" content="LINUX中常用操作命令">
<meta property="og:url" content="http://yoursite.com/2017/06/08/LinuxLine/index.html">
<meta property="og:site_name" content="韩月">
<meta property="og:description" content="LINUX中常用操作命令 Linux简介及Ubuntu安装Linux，免费开源，多用户多任务系统。基于Linux有多个版本的衍生。RedHat、Ubuntu、Debian安装VMware或VirtualBox虚拟机。具体安装步骤，找百度。再安装Ubuntu。具体安装步骤，找百度。安装完后，可以看到Linux系统的目录结构，见链接http://www.cnblogs.com/laov/p/3409">
<meta property="og:image" content="http://images.cnitblog.com/blog/352072/201402/091549405142313.png">
<meta property="og:updated_time" content="2017-06-30T03:30:10.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="LINUX中常用操作命令">
<meta name="twitter:description" content="LINUX中常用操作命令 Linux简介及Ubuntu安装Linux，免费开源，多用户多任务系统。基于Linux有多个版本的衍生。RedHat、Ubuntu、Debian安装VMware或VirtualBox虚拟机。具体安装步骤，找百度。再安装Ubuntu。具体安装步骤，找百度。安装完后，可以看到Linux系统的目录结构，见链接http://www.cnblogs.com/laov/p/3409">
<meta name="twitter:image" content="http://images.cnitblog.com/blog/352072/201402/091549405142313.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    sidebar: {"position":"left","display":"post","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/06/08/LinuxLine/"/>





  <title>LINUX中常用操作命令 | 韩月</title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?29caf0cef6e0beec50a83c0dcae17a3b";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">韩月</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-test">
          <a href="/test" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-eye"></i> <br />
            
            测试
          </a>
        </li>
      
        
        <li class="menu-item menu-item-menus">
          <a href="/menus" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-bars"></i> <br />
            
            菜单
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/06/08/LinuxLine/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="韩月">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/uploads/avatars.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="韩月">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                LINUX中常用操作命令
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-06-08T01:36:10+08:00">
                2017-06-08
              </time>
            

            

            
          </span>

          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/06/08/LinuxLine/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="2017/06/08/LinuxLine/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2017/06/08/LinuxLine/" class="leancloud_visitors" data-flag-title="LINUX中常用操作命令">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数 </span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    <div class="post-body" itemprop="articleBody">

      
      

      
        <p> LINUX中常用操作命令</p>
<h1 id="Linux简介及Ubuntu安装"><a href="#Linux简介及Ubuntu安装" class="headerlink" title="Linux简介及Ubuntu安装"></a>Linux简介及Ubuntu安装</h1><p>Linux，免费开源，多用户多任务系统。基于Linux有多个版本的衍生。RedHat、Ubuntu、Debian<br>安装VMware或VirtualBox虚拟机。具体安装步骤，找百度。<br>再安装Ubuntu。具体安装步骤，找百度。<br>安装完后，可以看到Linux系统的目录结构，见链接<a href="">http://www.cnblogs.com/laov/p/3409875.html
</a></p>
<pre><code>#常用指令
</code></pre><p>ls　　        显示文件或目录</p>
<pre><code>-l           列出文件详细信息l(list)

-a          列出当前目录下所有文件及目录，包括隐藏的a(all)
</code></pre><p>mkdir         创建目录</p>
<pre><code>-p           创建目录，若无父目录，则创建p(parent)
</code></pre><p>cd              切换目录</p>
<p>touch           创建空文件</p>
<p>echo            创建带有内容的文件。</p>
<p>cat              查看文件内容</p>
<p>cp                拷贝</p>
<p>mv               移动或重命名</p>
<p>rm               删除文件</p>
<pre><code>-r            递归删除，可删除子目录及文件
-f            强制删除
</code></pre><p>find              在文件系统中搜索某文件</p>
<p>wc                统计文本中行数、字数、字符数</p>
<p>grep             在文本文件中查找某个字符串</p>
<p>rmdir           删除空目录</p>
<p>tree             树形结构显示目录，需要安装tree包</p>
<p>pwd              显示当前目录</p>
<p>ln                  创建链接文件</p>
<p>more、less  分页显示文本文件内容</p>
<p>head、tail    显示文件头、尾内容</p>
<p>ctrl+alt+F1  命令行全屏模式</p>
<h1 id="系统管理命令"><a href="#系统管理命令" class="headerlink" title="系统管理命令"></a>系统管理命令</h1><p>stat              显示指定文件的详细信息，比ls更详细</p>
<p>who               显示在线登陆用户</p>
<p>whoami          显示当前操作用户</p>
<p>hostname      显示主机名</p>
<p>uname           显示系统信息</p>
<p>top                动态显示当前耗费资源最多进程信息</p>
<p>ps                  显示瞬间进程状态 ps -aux</p>
<p>du                  查看目录大小 du -h /home带有单位显示目录信息</p>
<p>df                  查看磁盘大小 df -h 带有单位显示磁盘信息</p>
<p>ifconfig          查看网络情况</p>
<p>ping                测试网络连通</p>
<p>netstat          显示网络状态信息</p>
<p>man                命令不会用了，找男人  如：man ls</p>
<p>clear              清屏</p>
<p>alias               对命令重命名 如：alias showmeit=”ps -aux” ，另外解除使用unaliax showmeit</p>
<p>kill                 杀死进程，可以先用ps 或 top命令查看进程的id，然后再用kill命令杀死进程。</p>
<h1 id="打包压缩相关命令"><a href="#打包压缩相关命令" class="headerlink" title="打包压缩相关命令"></a>打包压缩相关命令</h1><p>gzip：</p>
<p>bzip2：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">tar:                打包压缩</div><div class="line"></div><div class="line">     -c              归档文件</div><div class="line"></div><div class="line">     -x              压缩文件</div><div class="line"></div><div class="line">     -z              gzip压缩文件</div><div class="line"></div><div class="line">     -j              bzip2压缩文件</div><div class="line"></div><div class="line">     -v              显示压缩或解压缩过程 v(view)</div><div class="line"></div><div class="line">     -f              使用档名</div></pre></td></tr></table></figure>
<p>例：</p>
<p><code>tar -cvf /home/abc.tar /home/abc</code>             只打包，不压缩</p>
<p><code>tar -zcvf /home/abc.tar.gz /home/abc</code>          打包，并用gzip压缩</p>
<p><code>tar -jcvf /home/abc.tar.bz2 /home/abc</code>         打包，并用bzip2压缩</p>
<p>当然，如果想解压缩，就直接替换上面的命令  <code>tar -cvf  / tar -zcvf  / tar -jcvf</code> 中的“c” 换成“x” 就可以了。</p>
<h1 id="关机-重启机器"><a href="#关机-重启机器" class="headerlink" title="关机/重启机器"></a>关机/重启机器</h1><p>shutdown</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div></pre></td><td class="code"><pre><div class="line">-r             关机重启</div><div class="line"></div><div class="line">-h             关机不重启</div><div class="line"></div><div class="line">now            立刻关机</div><div class="line"></div><div class="line">halt            关机</div><div class="line"></div><div class="line">reboot          重启</div></pre></td></tr></table></figure>
<h1 id="Linux管道"><a href="#Linux管道" class="headerlink" title="Linux管道"></a>Linux管道</h1><p>将一个命令的标准输出作为另一个命令的标准输入。也就是把几个命令组合起来使用，后一个命令除以前一个命令的结果。</p>
<p>例：<code>grep -r &quot;close&quot; /home/* | more</code>       在<code>home</code>目录下所有文件中查找，包括<code>close</code>的文件，并分页输出。</p>
<h1 id="Linux软件包管理"><a href="#Linux软件包管理" class="headerlink" title="Linux软件包管理"></a>Linux软件包管理</h1><p>dpkg (Debian Package)管理工具，软件包名以.deb后缀。这种方法适合系统不能联网的情况下。</p>
<p>比如安装tree命令的安装包，先将tree.deb传到Linux系统中。再使用如下命令安装。</p>
<p><code>sudo dpkg -i tree_1.5.3-1_i386.deb</code>         安装软件</p>
<p><code>sudo dpkg -r tree</code>                             卸载软件</p>
<p>注：将tree.deb传到Linux系统中，有多种方式。VMwareTool，使用挂载方式；使用winSCP工具等；</p>
<p>APT（Advanced Packaging Tool）高级软件工具。这种方法适合系统能够连接互联网的情况。</p>
<p>依然以tree为例</p>
<p><code>sudo apt-get install tree</code>                   安装tree</p>
<p><code>sudo apt-get remove tree</code>                    卸载tree</p>
<p><code>sudo apt-get update</code></p>
<p>更新软件                <code>sudo apt-get upgrade</code></p>
<p>将.rpm文件转为.deb文件</p>
<p>.rpm为RedHat使用的软件格式。在Ubuntu下不能直接使用，所以需要转换一下。</p>
<p><code>sudo alien abc.rpm</code></p>
<h1 id="vim使用"><a href="#vim使用" class="headerlink" title="vim使用"></a>vim使用</h1><p>vim三种模式：命令模式、插入模式、编辑模式。使用ESC或i或：来切换模式。</p>
<p>命令模式下：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div></pre></td><td class="code"><pre><div class="line">:q                      退出</div><div class="line"></div><div class="line">:q!                     强制退出</div><div class="line"></div><div class="line">:wq                     保存并退出</div><div class="line"></div><div class="line">:set number             显示行号</div><div class="line"></div><div class="line">:set nonumber           隐藏行号</div><div class="line"></div><div class="line">/apache                 在文档中查找apache 按n跳到下一个，shift+n上一个</div><div class="line"></div><div class="line">yyp                     复制光标所在行，并粘贴</div><div class="line"></div><div class="line">h                       (左移一个字符←)、j(下一行↓)、k(上一行↑)、l(右移一个字符→)</div></pre></td></tr></table></figure>
<p>#用户及用户组管理<br>/etc/passwd    存储用户账号</p>
<p>/etc/group       存储组账号</p>
<p>/etc/shadow    存储用户账号的密码</p>
<p>/etc/gshadow  存储用户组账号的密码</p>
<p>useradd 用户名</p>
<p>userdel 用户名</p>
<p>adduser 用户名</p>
<p>groupadd 组名</p>
<p>groupdel 组名</p>
<p>passwd root     给root设置密码</p>
<p>su root</p>
<p>su - root </p>
<p>/etc/profile     系统环境变量</p>
<p>bash_profile     用户环境变量</p>
<p>.bashrc              用户环境变量</p>
<p>su user              切换用户，加载配置文件.bashrc</p>
<p>su - user            切换用户，加载配置文件/etc/profile ，加载bash_profile</p>
<h2 id="更改文件的用户及用户组"><a href="#更改文件的用户及用户组" class="headerlink" title="更改文件的用户及用户组"></a>更改文件的用户及用户组</h2><p><code>sudo chown [-R] owner[:group] {File|Directory}</code></p>
<p>例如：还以<code>jdk-7u21-linux-i586.tar.gz</code>为例。属于用户 「hadoop」 ，组 「hadoop」 </p>
<p>要想切换此文件所属的用户及组。可以使用命令。</p>
<p><code>sudo chown root:root jdk-7u21-linux-i586.tar.gz</code></p>
<h1 id="文件权限管理"><a href="#文件权限管理" class="headerlink" title="文件权限管理"></a>文件权限管理</h1><p>三种基本权限</p>
<p>R           读         数值表示为4</p>
<p>W          写         数值表示为2</p>
<p>X           可执行  数值表示为1</p>
<p><img src="http://images.cnitblog.com/blog/352072/201402/091549405142313.png" alt=""></p>
<p>如图所示，<code>jdk-7u21-linux-i586.tar.gz</code>文件的权限为<code>-rw-rw-r--</code></p>
<p><code>-rw-rw-r--</code>一共十个字符，分成四段。</p>
<p>第一个字符『-』表示普通文件；这个位置还可能会出现“l”链接；“d”表示目录</p>
<p>第二三四个字符『rw-』表示当前所属用户的权限。   所以用数值表示为4+2=6</p>
<p>第五六七个字符『rw-』表示当前所属组的权限。     所以用数值表示为4+2=6</p>
<p>第八九十个字符『r–』表示其他用户权限。        所以用数值表示为2</p>
<p>所以操作此文件的权限用数值表示为662 </p>
<h2 id="更改权限"><a href="#更改权限" class="headerlink" title="更改权限"></a>更改权限</h2><p><code>sudo chmod</code> 「u所属用户  g所属组  o其他用户  a所有用户]  [+增加权限  -减少权限]  [r  w  x」   目录名 </p>
<p>例如：有一个文件filename，权限为 「-rw-r—-x」 ,将权限值改为 <code>-rwxrw-r-x</code> ，用数值表示为<code>765</code></p>
<p><code>sudo chmod u+x g+w o+r  filename</code></p>
<p>上面的例子可以用数值表示</p>
<p><code>sudo chmod 765 filename</code></p>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        
  <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
    <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
    <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
      <span>赏</span>
    </button>
    <div id="QR" style="display: none;">
      
        <div id="wechat" style="display: inline-block">
          <img id="wechat_qr" src="/uploads/weixin.jpg" alt="韩月 WeChat Pay"/>
          <p>微信打赏</p>
        </div>
      
      
        <div id="alipay" style="display: inline-block">
          <img id="alipay_qr" src="/uploads/zhiply.jpg" alt="韩月 Alipay"/>
          <p>支付宝打赏</p>
        </div>
      
    </div>
  </div>


      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Linux/" rel="tag"># Linux</a>
          
            <a href="/tags/常用操作命令/" rel="tag"># 常用操作命令</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/06/08/Linuxtree/" rel="next" title="LINUX 目录结构">
                <i class="fa fa-chevron-left"></i> LINUX 目录结构
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/06/08/hexoinstall2/" rel="prev" title="hexo 折腾日记2">
                hexo 折腾日记2 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/uploads/avatars.gif"
               alt="韩月" />
          <p class="site-author-name" itemprop="name">韩月</p>
           
              <p class="site-description motion-element" itemprop="description">饮食习惯：酸辣甜、不能吃冷食喝凉水,会拉肚子。<br/>身材秘诀：吃得多，拉得也多。 <br>休闲嗜好：摄影、上网、睡觉、看恐怖惊悚片（我热爱科学，不惧鬼神）、发呆、流浪（更喜欢心在旅行，喜欢一人上路的洒脱、喜欢坐在热闹的集市看人来人往</p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          

          
            
            
            <div class="site-state-item site-state-tags">
              
                <span class="site-state-item-count">18</span>
                <span class="site-state-item-name">标签</span>
              
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/aidieq" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/your-user-name" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#Linux简介及Ubuntu安装"><span class="nav-number">1.</span> <span class="nav-text">Linux简介及Ubuntu安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#系统管理命令"><span class="nav-number">2.</span> <span class="nav-text">系统管理命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#打包压缩相关命令"><span class="nav-number">3.</span> <span class="nav-text">打包压缩相关命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#关机-重启机器"><span class="nav-number">4.</span> <span class="nav-text">关机/重启机器</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Linux管道"><span class="nav-number">5.</span> <span class="nav-text">Linux管道</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Linux软件包管理"><span class="nav-number">6.</span> <span class="nav-text">Linux软件包管理</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#vim使用"><span class="nav-number">7.</span> <span class="nav-text">vim使用</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#更改文件的用户及用户组"><span class="nav-number">7.1.</span> <span class="nav-text">更改文件的用户及用户组</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#文件权限管理"><span class="nav-number">8.</span> <span class="nav-text">文件权限管理</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#更改权限"><span class="nav-number">8.1.</span> <span class="nav-text">更改权限</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy;  2013 - 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">韩月</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Muse
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.1"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.1"></script>



  


  

    
      <script id="dsq-count-scr" src="https://.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://yoursite.com/2017/06/08/LinuxLine/';
          this.page.identifier = '2017/06/08/LinuxLine/';
          this.page.title = 'LINUX中常用操作命令';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  





  





  






  





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
  <script>AV.initialize("NKTDaSdUhTnAkDGbSDu7T9Vc-gzGzoHsz", "Q6OLnPhXA67rwYezNFkthzAw");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  

  

  

</body>
</html>
